<?php
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
file_get_contents("http://www.embryform.com/images/big/*.jpg");
exit;
//myglob("upfiles/3");
$path = "upfiles/3";
$path = "http://localhost/ydmx/upfiles/3";
//getfiles($path);
tree($path);
exit;
function tree($directory) 
{ 
$mydir=dir($directory); 
echo "<ul>\n"; 
while($file=$mydir->read()){ 
if((is_dir("$directory/$file")) AND ($file!=".") AND ($file!="..")) 
{echo "<li><font color=\"#ff00cc\"><b>$file</b></font></li>\n"; 
tree("$directory/$file"); 
} 
else 
echo "<li>$file</li>\n"; 
} 
echo "</ul>\n"; 
$mydir->close(); 
} 
function getfiles($path)  
 {  
     //if(!is_dir($path)) return;  
    $handle  = opendir($path);  
    print_r($handle);exit;
    while( false !== ($file = readdir($handle)))  
    {  
        if($file != '.'  &&  $file!='..')  
        {  
            $path2= $path.'/'.$file;  
            if(is_dir($path2))  
            {  
                echo '  ';  
                echo $file;  
               getfiles($path2);  
            }else 
            {  
               echo '  ';  
                echo $file;  
            }  
        }  
    }  
 }
function myglob($path)  
{  
    $path_pattern = $path.'/*';  
    $arr = glob($path_pattern);
    print_r($arr);
    exit;
    foreach(glob($path_pattern) as $file)  
    {  
            if(is_dir($file))  
            {  
                echo $file;  
                myscandir($file);  
            }else 
            {  
                echo $file.'  ';  
            }  
    }  
}

$binarydata = pack("nvc*", 0x1234, 0x5678, 65, 66);

echo $binarydata;

exit;
echo strtotime("2012-06-03");
echo  "<br/>";
echo strtotime("2012-06-02");
exit;
$str = '<font color="#0066FF">2012/6/2</font>';
$str = strip_tags($str);
$str = str_replace("/","-",$str);
echo $str;
exit;
//$content = '<table cellspacing="0" rules="all" border="1" id="ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_GridView1" width="581">ASDFASFASF</div>';
$content = '<table cellspacing="0" rules="all" border="1" id="ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_GridView1" width="581" style="font-family: 微软雅黑">safasfsaf</table>';
$content = '<td align="left" valign="middle" nowrap="nowrap">asdfsd</td>';

preg_match_all("/<td\s+align=\"[a-z]+?\"\s+valign=\"middle\"\s+nowrap=\"nowrap\">(.*)<\/td>/",$content,$rs);
print_r($rs);exit;
if(preg_match("/<table\s+cellspacing=\"0\"\s+rules=\"all\"\s+border=\"1\"\s+id=\"ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_GridView1\"\s+width=\"581\"\s+style=\".*\">(.*)<\/table>/",$content,$rs)){
	print_r($rs);
	echo "OK";
}else{
	echo "NO";
}


exit;
//@header("Content-Type:image/jpg");
@header("Content-Type: application/octet-stream");
$str = "加密解密ssss中国人的人家大";
echo $str;
/*$file = "images/h_img_right.jpg";
$fp = fopen($file,"r+");
$contents = fread($fp, filesize($file));
echo $contents;*/

exit;
$str = "加密解密ssss中国人的人家大";
$des = encode($str);
echo $des."<br/>";
echo decode($des);
exit;

function encode($str,$key=null){
	if(empty($str)){
		return "";
	}
	$s   = mt_rand(0, 100);
	$key = base64_encode($key);
	$str = base64_encode($str);
	
	$len = strlen($str);
	
	for($i=0;$i<$len;$i++){
		$intlen = 0;
		$int = base_convert(ord($str[$i]),10,2);
		$intlen = 8 - (int)strlen($int);
		for($j=0;$j<$intlen;$j++){
			$int = "0".$int;
		}
		
		$data .= $int;
	}
	
	return $data;
}

function decode($str,$key=null){
	if(empty($str)){
		return "";
	}
	$len = strlen($str);
	$len = $len/8;
	$start = 0;
	for($i=0;$i<$len;$i++){
		$data .= chr((int)base_convert((int)substr($str,$start,8),2,10));
		$start+=8;
	}
	
	return base64_decode($data);
}
//$url1 = "http://112.90.176.71/thirdparty/getcustomerphonebook.jsp?account=15889744181&e164name=&type=&loginName=admin&loginPassword=admin";
/*$url1 = "http://112.90.176.71/thirdparty/setcustomer.jsp?account=15889744181&name=15889744181&money=10.0&limitMoney=0.0&feerateGroup=10&lockType=0&agentAccount=&validTime=2011-09-29";

$url2 = "http://112.90.176.71/thirdparty/setphone.jsp?e164=15889744181&password=8888&displayNumber=8888&lockType=0&callLevel=5&rewriteRule=3:88&calleeBilling=0&capacity=10&customPassword=web&memo=&account=15889744181&loginName=admin&loginPassword=admin&operationType=0";

$url3 = "http://112.90.176.71/thirdparty/setactivephonecard.jsp?pin=123456&password=888888&account=15889744181&memo=test&loginName=admin&loginPassword=admin&operationType=0";

$url4 = "http://112.90.176.71/thirdparty/setbindede164.jsp?e164=15889744181&language=english&activePhoneCard=123456&memo=&loginName=admin&loginPassword=admin&operationType=0";

$rs1 = file_get_contents($url1);
print_r($rs1);

$rs2 = file_get_contents($url2);
print_r($rs2);

$rs3 = file_get_contents($url3);
print_r($rs3);

$rs4 = file_get_contents($url4);
print_r($rs4);*/